-
Notifications
You must be signed in to change notification settings - Fork 1.2k
*: add TiDB workload repository #20127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Co-authored-by: Roger Song <[email protected]>
/bot-review |
✅ AI review completed, 11 comments generated. |
workloadrepo.md
Outdated
|
||
## 快照采样过程(默认每小时) | ||
|
||
快照采样过程每 15 分钟到 2 小时运行一次,从存储累计指标的内存表中采样数据。快照由指定时间间隔内的某个 TiDB 节点发起,过程如下: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
快照采样过程每 15 分钟到 2 小时运行一次,从存储累计指标的内存表中采样数据。快照由指定时间间隔内的某个 TiDB 节点发起,过程如下: | |
快照采样过程每 15 分钟到 2 小时运行一次(默认每小时),从存储累计指标的内存表中采样数据。快照由指定时间间隔内的某个 TiDB 节点发起,过程如下: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
| `TIDB_INDEX_USAGE` | `HIST_TIDB_INDEX_USAGE` | 索引使用统计信息 | | ||
| `TIDB_STATEMENTS_STATS` | `HIST_TIDB_STATEMENTS_STATS` | 语句统计信息 | | ||
| `CLIENT_ERRORS_SUMMARY_BY_HOST` | `HIST_CLIENT_ERRORS_SUMMARY_BY_HOST` | 按主机的客户端错误摘要 | | ||
| `CLIENT_ERRORS_SUMMARY_BY_USER` | `HIST_CLIENT_ERRORS_SUMMARY_BY_USER` | 按用户的客户端错误摘要 | | ||
| `CLIENT_ERRORS_SUMMARY_GLOBAL` | `HIST_CLIENT_ERRORS_SUMMARY_GLOBAL` | 全局客户端错误摘要 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `TIDB_INDEX_USAGE` | `HIST_TIDB_INDEX_USAGE` | 索引使用统计信息 | | |
| `TIDB_STATEMENTS_STATS` | `HIST_TIDB_STATEMENTS_STATS` | 语句统计信息 | | |
| `CLIENT_ERRORS_SUMMARY_BY_HOST` | `HIST_CLIENT_ERRORS_SUMMARY_BY_HOST` | 按主机的客户端错误摘要 | | |
| `CLIENT_ERRORS_SUMMARY_BY_USER` | `HIST_CLIENT_ERRORS_SUMMARY_BY_USER` | 按用户的客户端错误摘要 | | |
| `CLIENT_ERRORS_SUMMARY_GLOBAL` | `HIST_CLIENT_ERRORS_SUMMARY_GLOBAL` | 全局客户端错误摘要 | | |
| [`TIDB_INDEX_USAGE`](/information-schema/information-schema-tidb-index-usage.md) | `HIST_TIDB_INDEX_USAGE` | 索引使用统计信息 | | |
| [`TIDB_STATEMENTS_STATS`](/statement-summary-tables.md) | `HIST_TIDB_STATEMENTS_STATS` | 语句统计信息 | | |
| [`CLIENT_ERRORS_SUMMARY_BY_HOST`](/information-schema/client-errors-summary-by-host.md) | `HIST_CLIENT_ERRORS_SUMMARY_BY_HOST` | 基于主机客户端的错误摘要 | | |
| [`CLIENT_ERRORS_SUMMARY_BY_USER`](/information-schema/client-errors-summary-by-user.md) | `HIST_CLIENT_ERRORS_SUMMARY_BY_USER` | 基于用户客户端的错误摘要 | | |
| [`CLIENT_ERRORS_SUMMARY_GLOBAL`](/information-schema/client-errors-summary-global.md) | `HIST_CLIENT_ERRORS_SUMMARY_GLOBAL` | 基于全局客户端的错误摘要 | |
快照采样过程每 15 分钟到 2 小时运行一次(默认每小时),从存储累计指标的内存表中采样数据。快照由指定时间间隔内的某个 TiDB 节点发起,过程如下: | ||
|
||
1. 从发起节点向 `HIST_SNAPSHOTS` 表插入一行,记录快照 ID、开始和结束时间戳以及服务器版本信息。 | ||
2. 在每个 TiDB 节点上,将源表中的所有行复制到带有 `HIST_` 前缀的对应历史表中。复制的数据包括源表中的原始列以及用于时间戳、实例 ID 和快照 ID 的附加列。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. 在每个 TiDB 节点上,将源表中的所有行复制到带有 `HIST_` 前缀的对应历史表中。复制的数据包括源表中的原始列以及用于时间戳、实例 ID 和快照 ID 的附加列。 | |
2. 在每个 TiDB 节点上,将源表中的所有行复制到带有 `HIST_` 前缀的对应目标表中。复制的数据包括源表中的原始列以及用于记录时间戳、实例 ID 和快照 ID 的附加列。 |
|
||
从以下表中采样数据: | ||
|
||
| 表名 | 目标表 | 描述 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 表名 | 目标表 | 描述 | | |
| 源表 | 目标表 | 描述 | |
|
||
从以下表中采样数据: | ||
|
||
| 表名 | 目标表 | 描述 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 表名 | 目标表 | 描述 | | |
| 源表 | 目标表 | 描述 | |
|
||
基于时间的采样间隔可设置为 1 秒到 600 秒之间的任意时间,从各个记录瞬时状态的系统表中采样数据。 | ||
|
||
当基于时间的采样过程运行时,源表中的所有行都会被复制到带有 `HIST_` 前缀的对应历史表中。复制的数据包括源表中的原始列以及用于时间戳和实例 ID 的附加列。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当基于时间的采样过程运行时,源表中的所有行都会被复制到带有 `HIST_` 前缀的对应历史表中。复制的数据包括源表中的原始列以及用于时间戳和实例 ID 的附加列。 | |
当基于时间的采样过程运行时,源表中的所有行都会被复制到带有 `HIST_` 前缀的对应目标表中。复制的数据包括源表中的原始列以及用于记录时间戳和实例 ID 的附加列。 |
```sql | ||
ADMIN WORKLOAD REPOSITORY TAKE SNAPSHOT; | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
运行这个语句是否有权限要求,如果有,这里需要补充下
## 手动快照 | ||
|
||
请注意,虽然快照采样过程会根据配置的时间间隔自动运行,但你也可以使用以下 SQL 语句触发手动快照: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
## 数据保留 | ||
|
||
系统会根据保留期设置自动清除数据,并使用分区进行高效的数据管理。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
系统会根据保留期设置自动清除数据,并使用分区进行高效的数据管理。 | |
Workload Repository 中历史数据默认保留 7 天。系统会根据保留期设置自动清除数据,并使用分区进行高效的数据管理。 |
## 注意事项 | ||
|
||
- 启用 Workload Repository 可能会对系统性能产生轻微影响。 | ||
- 采样间隔设置得过低可能会增加系统开销。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 采样间隔设置得过低可能会增加系统开销。 | |
- 采样间隔设置得过短可能会增加系统开销。 |
|
||
快照采样过程每 15 分钟到 2 小时运行一次(默认每小时),从存储累计指标的内存表中采样数据。快照由指定时间间隔内的某个 TiDB 节点发起,过程如下: | ||
|
||
1. 从发起节点向 `HIST_SNAPSHOTS` 表插入一行,记录快照 ID、开始和结束时间戳以及服务器版本信息。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. 从发起节点向 `HIST_SNAPSHOTS` 表插入一行,记录快照 ID、开始和结束时间戳以及服务器版本信息。 | |
1. 从发起节点向 `WORKLOAD_SCHEMA.HIST_SNAPSHOTS` 表插入一行,记录快照 ID、开始和结束时间戳以及服务器版本信息。 |
[LGTM Timeline notifier]Timeline:
|
SET GLOBAL tidb_workload_repository_retention_days = 30; | ||
``` | ||
|
||
此变量的较高值允许更长的数据保留时间,这可能有助于工作负载分析,但会增加存储需求。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此变量的较高值允许更长的数据保留时间,这可能有助于工作负载分析,但会增加存储需求。 | |
此变量的值越高,数据保留时间越长,这可能有助于工作负载分析,但会增加存储需求。 |
First-time contributors' checklist
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions (in Chinese).
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?